<template>
	<view>
		<view class="block_1">
			<view class="item_t">
				<view class="imgs">
					<image src="/static/bj.png" mode=""></image>
				</view>
				<view class="i_r">
					<view class="tit">{{datainfo.customerName}}</view>
					<view class="order">{{datainfo.customerAddress}}</view>
				</view>
			</view>
			<view class="it_flex">
				<view class="its" style="color: #3D81FF;" @click="$callPhone(datainfo.customerPhone)">
					<image src="/static/q1.png" mode=""></image>
					{{datainfo.customerPhone}}
				</view>
				<view class="x"></view>
				<view class="its" @click="$clipCz(datainfo.customerFax)">
					<image src="/static/q2.png" mode=""></image>
					{{datainfo.customerFax}}
				</view>
			</view>
			<view class="ulsi">
				<view class="item">
					<view class="t">报价单号：</view>
					<view class="r">
						{{datainfo.orderNumber}}
					</view>
				</view>
				<view class="item">
					<view class="t">含税合计：</view>
					<view class="r">
						<span>￥{{datainfo.amountInclusive|numberToCurrencyNo}}</span>
					</view>
				</view>
				<view class="item">
					<view class="t">税 额：</view>
					<view class="r">
						￥{{datainfo.amountTax|numberToCurrencyNo}}
					</view>
				</view>
				<view class="item">
					<view class="t">未税合计：</view>
					<view class="r">
						￥{{datainfo.amountExclusive|numberToCurrencyNo}}
					</view>
				</view>
				<view class="item">
					<view class="t">付款计划：</view>
					<view class="r">
						{{datainfo.payPlan}}
					</view>
				</view>
				<view class="item">
					<view class="t">产品附件：</view>
					<view class="r">
						{{datainfo.remark}}
					</view>
				</view>
				<view class="item">
					<view class="t">创建时间：</view>
					<view class="r">
						{{datainfo.createTime}}
					</view>
				</view>
				<view class="item">
					<view class="t">更新时间：</view>
					<view class="r">
						{{datainfo.updateTime}}
					</view>
				</view>
			</view>
		</view>



		<view class="block">
			<view class="title">
				<view class="">
					产品信息
				</view>
				<view class="tit_r" v-if="datainfo.productList">
					共 {{datainfo.productList.length}} 个
				</view>
			</view>
			<view class="uu" v-for="(item,index) in datainfo.productList" :key="index">
				<view class="items">
					<view class="item_l">
						产品名称
					</view>
					<view class="item_rr">
						<view class="">
							{{item.productName}}
						</view>
						<view class="xbtn" @click="openchange(item)">
							{{item.isopen?'展开':'收起'}}
							<uni-icons color="#0201F9" :type="item.isopen?'down':'up'"></uni-icons>
						</view>
					</view>
				</view>
				<view class="" v-if="!item.isopen">
					<view class="item">
						<view class="item_l">
							型号/规格
						</view>
						<view class="item_r">
							{{item.productSpecs}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							单位
						</view>
						<view class="item_r">
							{{item.productUnit}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							数量
						</view>
						<view class="item_r">
							{{item.productCount}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							备注
						</view>
						<view class="item_r">
							{{item.remark}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							含税单价
						</view>
						<view class="item_r">
							{{item.priceInclusive}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							未税单价
						</view>
						<view class="item_r">
							{{item.priceExclusive | numberToCurrencyNo}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							含税小计
						</view>
						<view class="item_r">
							{{item.totalAmountInclusive|numberToCurrencyNo}}
						</view>
					</view>
					<view class="item">
						<view class="item_l">
							未税小计
						</view>
						<view class="item_r">
							{{item.totalAmountExclusive|numberToCurrencyNo}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="" style="height: 200rpx;">
			
		</view>

		<view class="footerbtn">
			<view class="cont">
				<view class="btn1" @click="goindex">
					返回首页
				</view>
				<view class="btn" @click="gocontract">
					创建合同
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		orderInfo
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				datainfo: {},
				id:''
			};
		},
		onLoad(option) {
			this.id = option.id
			orderInfo({
				id: option.id
			}).then(res => {
				res.data.productList.forEach(item=>{
					item.isopen = true
				})
				this.datainfo = res.data
			})
		},
		methods: {
			openchange(item){
				console.log(item);
				item.isopen = !item.isopen
			},
			goindex() {
				uni.redirectTo({
					url: '/pages/index/index'
				})
			},
			gocontract() {
				uni.navigateTo({
					url: `/pages/index/contract?id=${this.id}&&istype=0`
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F7F8FA;
	}

	.block_1 {
		width: 710rpx;
		background: #FFFFFF;
		margin: 20rpx auto;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 40rpx 30rpx 10rpx 30rpx;
		box-sizing: border-box;

		.item_t {
			display: flex;

			.imgs {
				width: 100rpx;
				height: 100rpx;
				background: #5F79FB;
				border-radius: 50rpx;
				display: flex;
				justify-content: center;
				align-items: center;

				image {
					width: 52rpx;
					height: 52rpx;
					display: block;
				}
			}

			.i_r {
				margin-left: 20rpx;

				.tit {
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #000000;
				}

				.order {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #000000;
					margin-top: 10rpx;
				}
			}

		}

		.it_flex {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0rpx 40rpx;
			margin-top: 28rpx;
			padding-bottom: 26rpx;
			border-bottom: 1px solid #DADADA;

			.its {
				display: flex;
				align-items: center;

				image {
					width: 30rpx;
					height: 30rpx;
					margin-right: 14rpx;
				}

				font-family: PingFang SC,
				PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #979797;
			}

			.x {
				width: 2rpx;
				height: 30rpx;
				background-color: #D1D1D6;
			}
		}

		.ulsi {
			.item {
				margin: 24rpx auto;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #000;
				display: flex;
				align-items: center;

				.t {
					color: #979797;
					width: 150rpx;
				}

				.r {
					flex: 1;
				}

				span {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 40rpx;
					color: #F67220;
				}
			}
		}
	}


	.block {
		width: 710rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 32rpx 30rpx;
		box-sizing: border-box;
		margin: 20rpx auto;

		.title {
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #000000;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.tit_r {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #000000;
			}
		}

		.uu {
			.items{
				margin-top: 26rpx;
				display: flex;
				align-items: center;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #DADADA;
				
				.item_l {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #979797;
					width: 160rpx;
				}
				.item_rr {
					flex: 1;
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 28rpx;
				
					.xbtn {
						font-size: 24rpx;
						color: #0201F9;
					}
				}
			}
			.item {
				margin-top: 26rpx;
				display: flex;
				align-items: center;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #DADADA;

				.item_l {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #979797;
					width: 160rpx;
				}

				.item_r {
					margin-left: 20rpx;
					font-size: 28rpx;
				}

				
			}

		}

		// .uu:last-child .item {
		// 	border: none;
		// 	padding-bottom: 0rpx;
		// }

	}

	.footerbtn {
		width: 750rpx;
		height: 120rpx;
		background: #FFFFFF;
		position: fixed;
		bottom: 0%;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		z-index: 99;

		.cont {
			display: flex;
			padding: 10rpx 20rpx;
			height: 120rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			align-items: center;
			justify-content: space-between;

			.btn1 {
				width: 290rpx;
				height: 80rpx;
				background: #F7F8FA;
				border-radius: 40rpx;
				border: 1rpx solid #3658FF;
				color: #3658FF;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				line-height: 80rpx;
				text-align: center;
			}

			.btn {
				width: 400rpx;
				height: 80rpx;
				background: #3658FF;
				border-radius: 40rpx;
				color: #FFFFFF;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				line-height: 80rpx;
				text-align: center;
			}
		}
	}
</style>